Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add PlatformOrGuideName and PlatformSdkPackageName components #9200

Merged
merged 2 commits into from
Feb 28, 2024

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Feb 22, 2024

This PR adds two components that return the name and SDK package name of the currently selected platform.

  • PlatformSdkPackageName returns the package name, e.g. @sentry/nextjs
  • PlatformOrGuideName returns the name of the currently selected platform or guide, e.g. Next.JS

Motivation: We have a lot of pages where we statically write a package name (e.g. @sentry/browser) which doesn't change when users select a guide (e.g. NextJS). This leads to confusion. Reportedly from SEs, thought they'd need to install and initialize the browser SDK in addition to the NextJS SDK.

Alternatives: Sure, we could also copy the guide per platform (IIRC we did this for Replay a while back) but it's arguably more work if the changes between these files are literally the name of a package or framework.

Let me know what you think, happy to adjust or close this if you have better ideas!

Example page with dynamic sdk/platform name

PS: Please assume I know next to nothing about NextJS or RSC when reviewing this PR ;)

Copy link

vercel bot commented Feb 22, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sentry-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 27, 2024 8:04pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
sentry-docs-next ⬜️ Ignored (Inspect) Visit Preview Feb 27, 2024 8:04pm

Comment on lines +29 to +37
- Install the <PlatformSdkPackageName fallback="@sentry/browser"/> SDK, minimum version 7.60.0
- Configure the document response header to include `Document-Policy: js-profiling`
- Configure the SDK to use the `BrowserProfilingIntegration` and set `profilesSampleRate`

## Step 1: Install the JavaScript Browser SDK
## Step 1: Install the <PlatformOrGuideName/> SDK

<PlatformSection notSupported={["javascript.electron"]}>

Install our JavaScript browser SDK using either `yarn` or `npm`, the minimum version that supports profiling is **7.60.0**.
Install our <PlatformOrGuideName/> SDK using either `yarn` or `npm`, the minimum version that supports profiling is **7.60.0**.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the concrete use case I want to fix (which was reported by our sales engineers today in Slack).

Copy link

@mjq-sentry mjq-sentry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept sounds great to me. Commented re: one suspicious line, otherwise LGTM!

src/components/platformOrGuideName.tsx Outdated Show resolved Hide resolved
Copy link

@mjq-sentry mjq-sentry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! 🚢

@Lms24 Lms24 merged commit 6e9813b into master Feb 28, 2024
8 checks passed
@Lms24 Lms24 deleted the lms/feat-add-platform-name-and-package-component branch February 28, 2024 12:56
@github-actions github-actions bot locked and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants